package com.kg.elysia.config;

import io.vertx.config.ConfigRetriever;
import io.vertx.config.ConfigRetrieverOptions;
import io.vertx.config.ConfigStoreOptions;
import io.vertx.core.Future;
import io.vertx.core.Vertx;
import io.vertx.core.json.JsonObject;

/**
 * <p>
 *
 * </p>
 *
 * @author zj
 * @since 2025/10/20 14:46
 */
public class ConfigLoader {

    public static Future<JsonObject> load(Vertx vertx) {
        ConfigStoreOptions envStore = new ConfigStoreOptions()
                .setType("env")
                .setConfig(new JsonObject().put("raw-data", true));

        ConfigRetriever retriever = ConfigRetriever.create(vertx,
                new ConfigRetrieverOptions().addStore(envStore));

        return Future.future(retriever::getConfig);
    }

}
